package com.heima.search.web;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.search.service.ApUSerSearchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * APP用户搜索信息表 前端控制器
 * </p>
 */
@Slf4j
@RestController
@RequestMapping("/api/v1/history")
public class ApUserSearchController{

    @Autowired
    private ApUSerSearchService searchService;

    @PostMapping("/load")
    public ResponseResult findUserSearch(@RequestBody Map<String,Integer> map) {
        Integer pageSize = map.get("pageSize");
        return searchService.load(pageSize);
    }

    @PostMapping("/del")
    public ResponseResult removeSearchHistory(@RequestBody Map<String,String> map){
        String id = map.get("id");
        return searchService.removeHistory(id);
    }
}